package com.lwc.controller;

import com.lwc.bean.Order;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderController {


    @Autowired
    RestTemplate restTemplate;

    @Value("${updatestock}")
     String  updatestock;

    @PostMapping ("/save")
    public  String save(@RequestBody Order order){
    //生成订单
        System.out.println("生成订单"+order.toString());
        //更新库存

restTemplate.put(updatestock,order.getOrderDetails());
        return "ok";
    }


}
